/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package model;

import java.io.Serializable;
import java.util.List;

import controll.Mapping;

/**
 *
 * @author phuc
 */
public class Tuyen implements Serializable {
    private static final long serialVersionUID = 1L;
    private Long tuyenID;
    private String ten;
    private String huong;
    private List<Tau> tauList;
    private Mapping map  = new Mapping();
    
    
    public Tuyen() {
    }

    public Tuyen(Long tuyenID) {
        this.tuyenID = tuyenID;
    }

    public Tuyen(Long tuyenID, String ten, String huong) {
        this.tuyenID = tuyenID;
        this.ten = ten;
        this.huong = huong;
    }

    public Long getTuyenID() {
        return tuyenID;
    }

    public void setTuyenID(Long tuyenID) {
        this.tuyenID = tuyenID;
    }

    public String getTen() {
        return ten;
    }

    public void setTen(String ten) {
        this.ten = ten;
    }

    public String getHuong() {
        return huong;
    }

    public void setHuong(String huong) {
        this.huong = huong;
    }

    /**
     * @return List tau thuoc tuyen
     */
    public List<Tau> getTauList() {
    	map.getListTau(this);
        return tauList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (tuyenID != null ? tuyenID.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Tuyen)) {
            return false;
        }
        Tuyen other = (Tuyen) object;
        if ((this.tuyenID == null && other.tuyenID != null) || (this.tuyenID != null && !this.tuyenID.equals(other.tuyenID))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entity.Tuyen[ tuyenID=" + tuyenID + " ]";
    }
    
    /**
     * Get "Tuyen" by tauID
     * @return
     */
    public Tuyen getTuyenByTuyenID(Long tuyenID){
    	return map.getTuyenByTuyenID(tuyenID);
    }
    
}
